﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="fck.aspx.cs" Inherits="fck" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
	<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
	<script type="text/javascript" src="ckfinder/ckfinder.js"></script>
</head>
<body>
          <textarea id="editor1" name="editor1" rows="10" cols="80"><p>dddJust click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p></textarea>
	
		<script type="text/javascript">

		    // This is a check for the CKEditor class. If not defined, the paths must be checked.
		    if (typeof CKEDITOR == 'undefined') {
		        document.write('您的浏览器不支持此编辑器');
		    }
		    else {
		        var editor = CKEDITOR.replace('editor1');

		        // Just call CKFinder.SetupCKEditor and pass the CKEditor instance as the first argument.
		        // The second parameter (optional), is the path for the CKFinder installation (default = "/ckfinder/").
		        CKFinder.SetupCKEditor(editor, '/ckfinder/');

		        // It is also possible to pass an object with selected CKFinder properties as a second argument.
		        // CKFinder.SetupCKEditor( editor, { BasePath : '../../', RememberLastFolder : false } ) ;	
		    }

		</script>

         <script type="text/javascript">
             var img;
             function BrowseServer(inputId) {
                 img = inputId;
             var finder = new CKFinder();
             finder.BasePath = "ckfinder/";  //导入CKFinder的路径                
         finder.SelectFunction = SetFileField; //设置文件被选中时的函数                
           finder.selectActionData = inputId;  //接收地址的input ID                
           finder.Popup(); 
     }
     //文件选中时执行                
     function SetFileField(fileUrl, data) {
         document.getElementById(img).value = fileUrl;                
         }            </script>            
         <p>                
         <input type="text" id="test"/>
         <input type="button" onclick="BrowseServer('test') " />
         </p>
</body>
</html>
